import type { AxiosRequestConfig, AxiosResponse } from "axios";

// 定义拦截器接口
export interface InterceptorsHooks<T = AxiosResponse> {
  requestInterceptors?: (config: AxiosRequestConfig) => AxiosRequestConfig;
  requestInterceptorsCatch?: (error: any) => any;
  responseInterceptors?: (res: T) => T;
  responseInterceptorsCatch?: (error: any) => any;
}

// 接口扩展，让requestConfig即接受AxiosRequestConfigd的约束也接受InterceptorsHooks约束
export interface RequestConfig<T = AxiosResponse> extends AxiosRequestConfig {
  interceptors?: InterceptorsHooks<T>;
}
